﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Celltest
{
    class Cell
    {
        byte b = 0;
        public Position pos = new Position();
        GUI gui = new GUI();
        public Cell(int startx = 0, int starty = 0)
        {
        }
        private void Top(int width)
        {
            pos = new Position();
            pos.Y++;

            for (int i = 0; i < width; i++)
            {
                if (pos.X == 0)
                {
                    b = 201;
                }
                else if (pos.X == width - 1)
                {
                    b = 183;
                }
                else
                {
                    b = 205;
                }
                pos.X++;
                gui.WriteAt(b, pos);
            }
            pos = new Position();

        }
        private void LeftWall(int height)
        {
            pos.Y++;
            pos.X++;
            for (int i = 0; i < height; i++)
            {
                b = 186;
                pos.Y++;
                gui.WriteAt(b, pos);
            }
            pos = new Position();
        }

        private void RigtWall(int height, int width)
        {
            pos.Y++;

            for (int i = 0; i < height; i++)
            {
                b = 186;
                pos.Y++;
                pos.X = width;
                gui.WriteAt(b, pos);
            }
            pos = new Position();
        }

        private void MakeBottom(int height, int width)
        {
            height++;
            pos.Y++;
            pos.Y = height;
            for (int i = 0; i < width; i++)
            {
                if (pos.X == 0)
                {
                    b = 212;
                }
                else if (pos.X == width - 1)
                {
                    b = 190;
                }
                else
                {
                    b = 205;
                }
                pos.X++;

                gui.WriteAt(b, pos);
            }
        }


        public void MakeCell(int width, int height)
        {
            Top(width);
            LeftWall(height);
            RigtWall(height, width);
            MakeBottom(height, width);

        }
    }
}
